// PRCamera.cpp
//

#include "PursuitRender.h"

PRCamera::PRCamera()
{
	nearPlane = 0.1f;
	farPlane = 10000.0f;

	xrot = 0.0f;
	yrot = 0.0f;

	position = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
}

PRCamera::~PRCamera()
{
	
}

void PRCamera::Update(float deltatime)
{
	calculateViewProj();
}

void PRCamera::calculateViewProj()
{
	float x = sinf(xrot) * cosf(yrot);
	float y = sinf(yrot);
	float z = cosf(xrot) * cosf(yrot);

	D3DXVECTOR3 lookat = D3DXVECTOR3(x, y, z);
	D3DXVECTOR3 up = D3DXVECTOR3(0.0f, 1.0f, 0.0f);

	D3DXMatrixLookAtLH(&viewMatrix, &position, &lookat, &up);
	D3DXMatrixPerspectiveLH(&projMatrix, 800, 600, nearPlane, farPlane);
}

float PRCamera::GetNearPlane()
{
	return nearPlane;
}

float PRCamera::GetFarPlane()
{
	return farPlane;
}

void PRCamera::SetNearPlane(float v)
{
	nearPlane = v;
}

void PRCamera::SetFarPlane(float v)
{
	farPlane = v;
}